{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "536a1dd5-78f4-458a-8727-89c29ed86217",
   "metadata": {},
   "source": [
    "# Kernel Density Estimate (KDE) Plot\n",
    "\n",
    "A KDE plot showing the distribution of body mass across penguin species. This plot highlights how different species vary in average size and spread."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "91c19e02-d3b3-4170-8f31-944b96e348c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "import hvplot.pandas  # noqa\n",
    "\n",
    "df = hvplot.sampledata.penguins(\"pandas\")\n",
    "\n",
    "df.hvplot.kde(\n",
    "    y='body_mass_g',\n",
    "    by='species',\n",
    "    title='Penguin Body Mass by Species (Bokeh)',\n",
    "    xlabel='Body Mass (g)',\n",
    "    ylabel='Density',\n",
    "    yformatter='%.0e'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ecc71589-b664-4784-b03f-053fb986f9ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "import hvplot.pandas  # noqa\n",
    "hvplot.extension('matplotlib')\n",
    "\n",
    "df = hvplot.sampledata.penguins(\"pandas\")\n",
    "\n",
    "df.hvplot.kde(\n",
    "    y='body_mass_g',\n",
    "    by='species',\n",
    "    title='Penguin Body Mass by Species (Matplotlib)',\n",
    "    xlabel='Body Mass (g)',\n",
    "    ylabel='Density',\n",
    "    yformatter='%.0e'\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e251eb83-4830-48e7-97eb-7f90820111f8",
   "metadata": {},
   "source": [
    ":::{seealso}\n",
    "- [KDE reference documentation](../../ref/api/manual/hvplot.hvPlot.kde.ipynb).\n",
    ":::"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
